
(function( $ ) {
	$.widget( "ui.grid", {
		_create: function() {
			this._draw();
		},
		_draw: function() {
			var uiGrid = (this.uiGrid = $("<div class='ui-widget ui-grid'></div>")).insertBefore(this.element),
				uiGridHead = (this.uiGridHead = $("<div class='ui-widget-header ui-grid-head'></div>")).appendTo(uiGrid),
				uiGridBody = (this.uiGridBody = $("<div class='ui-widget-content ui-grid-body'></div>")).appendTo(uiGrid),
				uiGridFoot = (this.uiGridFoot = $("<div class='ui-widget-header ui-grid-foot'></div>")).appendTo(uiGrid),
				uiGridHeadTable = (this.uiGridHeadTable = $("<table class='ui-widget-content ui-grid-head-table'></table>")).appendTo( uiGridHead),
				uiGridBodyTable = (this.uiGridBodyTable = this.element).addClass("ui-grid-body-table").appendTo(uiGridBody),
				uiGridFootTable = (this.uiGridFootTable = $("<table class='ui-widget-content ui-grid-foot-table'></table>")).appendTo(uiGridFoot);
			
			uiGridBodyTable.find("caption").addClass("ui-widget-header").prependTo(uiGridHeadTable);
			
			uiGridBodyTable.find("colgroup").clone().appendTo(uiGridHeadTable).clone().appendTo(uiGridFootTable);
			
			uiGridBodyTable.find("thead").appendTo(uiGridHeadTable);
			
			uiGridBodyTable.find("tfoot").appendTo(uiGridFootTable);
			
			uiGridHeadTable.find( "tr" ).addClass( "ui-state-default" );
		},
		_columns: function() {
			$.each(this.uiGridHeadTable.find( "th" ), function(index, th) {
				
			});
			var head = this.uiGridHeadTable.find( "thead" );
			if (!head.find("th").length) {
				
			}
		}
	});
}( jQuery ));